﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace Library.Test.Logic
{

    public delegate string AsycDelegate(out string outArg, string inArg);//委托定义
    public delegate string AsycTwoDelegate(string inArg);//委托定义

    /// <summary>
    /// 异步委托
    /// </summary>
    public class DelegateAsyService
    {

        public static string AsyncMethod(out string fromThisMethod, string toThisMethod)
        {
            Console.WriteLine("<< enter the AsyncMethod!");
            fromThisMethod = "string form AsyncWork.AsyncMehod as a out parameter";

            Console.WriteLine("传入此异步方法的参数：{0}", toThisMethod);
            Thread.Sleep(6000);//该方法会阻塞运行此方法的线程六秒（个人理解是子线程）

            Console.WriteLine("end the AsyncMehod >>");

            return "AsyncMethod!";
        }


        public static string AsyncMethodTwo(string toThisMethod)
        {
            Console.WriteLine("传入此异步方法的参数：{0}", toThisMethod);
            Thread.Sleep(6000);//该方法会阻塞运行此方法的线程六秒（个人理解是子线程）
            Console.WriteLine("end the AsyncMehod >>");
            return "AsyncMethodTwo!";
        }

       
    }
}
